import type { App } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

// 导入所有的 store
import { useJudgeStore } from './store/judge'
import { useUserStore } from './store/user'

const store = createPinia()

// 使用 persisted state 插件
store.use(piniaPluginPersistedstate)

export const setupStore = (app: App<Element>) => {
  app.use(store)
}

export { store, useJudgeStore, useUserStore }
